package article

import "elegantGo/chapter17/oo/primitive"

const (
	CategoryFree = 0
	CategoryPaid = 10
	CategoryVip  = 20
)

type Category struct {
	primitive.Int
}

type Content struct {
	primitive.String
}

func (o *Content) GetContent() string {
	return o.Value()
}

func (o *Content) SetContent(v string) {
	o.SetValue(v)
}

func (o *Content) PreviewExtract() {
	// 普通用户 试读20% vip试读40%
	o.SetValue(string([]rune(o.Value())[:4]) + "**")
}

type ContentMasker struct {
	Content
}

func (o *ContentMasker) Mask() {
	o.PreviewExtract()
}

type ReadCount struct {
	primitive.Int
}

type SaleCount struct {
	primitive.Int
}

type Summary struct {
	primitive.String
}

type Title struct {
	primitive.String
}
